package com.finance.cooperate.feature.reader;

import com.finance.cooperate.feature.base.ReaderImpl;
import com.finance.cooperate.feature.core.feature.FeatureDefinition;
import com.finance.cooperate.feature.dto.BorrowingDTO;

import java.util.Map;

public class BorrowingReader extends ReaderImpl {

    @Override
    public Map<String, String> read(String userId) {

        BorrowingDTO info = borrowingService.getInfo(userId);

        super.put(FeatureDefinition.f_borrowing_max_overdue_days, info.getMaxOverdueDays());
        super.put(FeatureDefinition.f_borrowing_min_overdue_days, info.getMinOverdueDays());
        super.put(FeatureDefinition.f_borrowing_avg_overdue_days, info.getAvgOverdueDays());
        super.put(FeatureDefinition.f_borrowing_avg_prepayment_hours, info.getAvgPrepaymentHours());
        super.put(FeatureDefinition.f_borrowing_max_prepayment_hours, info.getMaxPrepaymentHours());
        super.put(FeatureDefinition.f_borrowing_min_prepayment_hours, info.getMinPrepaymentHours());
        super.put(FeatureDefinition.f_borrowing_avg_loan_and_risk_interval_hours, info.getAvgLoanAndRiskIntervalHours());
        super.put(FeatureDefinition.f_borrowing_last_loan_and_risk_interval_hours, info.getLastLoanAndRiskIntervalHours());
        super.put(FeatureDefinition.f_borrowing_last_payoff_hour, info.getLastPayoffHour());

//        Integer overdueCount = borrowingService.sameIpOverdueStatue(userId);

//        super.put(FeatureDefinition.f_borrowing_same_ip_overdue_count, overdueCount);

        return super.getResult();
    }

}
